package com.spring.zhz.javaconfig;

import com.spring.zhz.javaconfig.model.ConfigUser;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class MainTestConfig {
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(JavaConfigBeans.class, ConfigBeans2.class);
        System.out.println(((ConfigUser) context.getBean("getConfigUser")).toString());
        System.out.println(context.getBean("configUser2", ConfigUser.class).toString());

        ApplicationContext context2 = new AnnotationConfigApplicationContext(JavaConfigBeans.class);
        System.out.println(context2.getBean("getConfigUser", ConfigUser.class).toString());
        System.out.println(context2.getBean("configUser2", ConfigUser.class).toString());

    }
}